import {createRouter, createWebHashHistory} from 'vue-router'
import Layout from '@/views/Layout.vue'

const router = createRouter({
    history: createWebHashHistory(),
    routes: [
        {
            path: '/home/login',
            name: 'home_login',
            component: () => import("../views/home/Login.vue"),
        },
        {
            path: '/home/register',
            name: 'home_register',
            component: () => import("../views/home/Register.vue"),
        },
        {
            path: '/user/desc',
            name: 'user_desc',
            component: () => import("../views/user/Desc.vue"),
        },
        {
            path: '/user/desc/nickname',
            name: 'user_desc_nickname',
            component: () => import("../views/user/desc/Nickname.vue"),
        },
        {
            path: '/patient/index',
            name: 'patient_index',
            component: () => import("../views/patient/Index.vue"),
        },
        {
            path: '/patient/add',
            name: 'patient_add',
            component: () => import("../views/patient/Add.vue"),
        },
        {
            path: '/patient/edit/:name',
            name: 'patient_edit',
            component: () => import("../views/patient/Edit.vue"),
        },
        {
            path: '/patient/desc/:name',
            name: 'patient_desc',
            component: () => import("../views/patient/Desc.vue"),
        },
        {
            path: '/patient/wardRoundRecord',
            name: 'patient_wardRoundRecord',
            component: () => import("../views/patient/WardRoundRecord.vue"),
        },
        {
            path: '/assessment/riskAssessment',
            name: 'assessment_riskAssessment',
            component: () => import("../views/assessment/RiskAssessment.vue"),
        },
        {
            path: '/assessment/MUST/:name',
            name: 'assessment_MUST',
            component: () => import("../views/assessment/MUST.vue"),
        },
        {
            path: '/assessment/NRS-2002/:name',
            name: 'assessment_NRS-2002',
            component: () => import("../views/assessment/NRS-2002.vue"),
        },
        {
            path: '/plan/index',
            name: 'plan/index',
            component: () => import("../views/plan/Index.vue"),
        },
        {
            path: '/plan/createPlan/:name',
            name: 'plan_createPlan',
            component: () => import("../views/plan/CreatePlan.vue"),
        },
        {
            path: '/plan/nutritionPlan/index/:name',
            name: 'plan_nutritionPlan_index',
            component: () => import("../views/plan/nutritionPlan/Index.vue"),
        },
        {
            path: '/plan/nutritionPlan/mealPlan/:name',
            name: 'plan_nutritionPlan_mealPlan',
            component: () => import("../views/plan/nutritionPlan/MealPlan.vue"),
        },
        {
            path: '/plan/nutritionPlan/enteralNutritionPlan/:name',
            name: 'plan_nutritionPlan_enteralNutritionPlan',
            component: () => import("../views/plan/nutritionPlan/EnteralNutritionPlan.vue"),
        },
        {
            path: '/plan/nutritionPlan/parenteralNutritionPlan/:name',
            name: 'plan_nutritionPlan_parenteralNutritionPlan',
            component: () => import("../views/plan/nutritionPlan/ParenteralNutritionPlan.vue"),
        },
        {
            path: '/repository/product',
            name: 'repository_product',
            component: () => import("../views/repository/Product.vue"),
        },
        {
            path: '/repository/expiryTime',
            name: 'repository_expiryTime',
            component: () => import("../views/repository/ExpiryTime.vue"),
        },
        {
            path: '/repository/record',
            name: 'repository_record',
            component: () => import("../views/repository/Record.vue"),
        },
        {
            path: '/cost/cost',
            name: 'cost_cost',
            component: () => import("../views/cost/Cost.vue"),
        },
        {
            path: '/cost/sheet',
            name: 'cost_sheet',
            component: () => import("../views/cost/Sheet.vue"),
        },
        {
            path: '/cost/budget',
            name: 'cost_budget',
            component: () => import("../views/cost/Budget.vue"),
        },
        {
            path: '/meal/meal',
            name: 'meal_meal',
            component: () => import("../views/meal/Meal.vue"),
        },
        {
            path: '/meal/book',
            name: 'meal_book',
            component: () => import("../views/meal/Book.vue"),
        },
        {
            path: '/meal/record',
            name: 'meal_record',
            component: () => import("../views/meal/Record.vue"),
        },
        {
            path: '/eras/pre',
            name: 'eras_pre',
            component: () => import("../views/eras/Pre.vue"),
        },
        {
            path: '/eras/after',
            name: 'eras_after',
            component: () => import("../views/eras/After.vue"),
        },
        {
            path: '/eras/feedBack',
            name: 'eras_feedBack',
            component: () => import("../views/eras/FeedBack.vue"),
        },
        {
            path: '/slow_patient/patient',
            name: 'slow_patient_patient',
            component: () => import("../views/slow_patient/Patient.vue"),
        },
        {
            path: '/slow_patient/food',
            name: 'slow_patient_food',
            component: () => import("../views/slow_patient/Food.vue"),
        },
        {
            path: '/slow_patient/learn',
            name: 'slow_patient_learn',
            component: () => import("../views/slow_patient/Learn.vue"),
        },
        {
            path: '/product/assessment',
            name: 'product_assessment',
            component: () => import("../views/product/Assessment.vue"),
        },
        {
            path: '/product/control',
            name: 'product_control',
            component: () => import("../views/product/Control.vue"),
        },
        {
            path: '/product/report',
            name: 'product_report',
            component: () => import("../views/product/Report.vue"),
        },
        {
            path: '/mobile/healthMonitoring',
            name: 'mobile_healthMonitoring',
            component: () => import("../views/mobile/HealthMonitoring.vue"),
        },
        {
            path: '/mobile/communication',
            name: 'mobile_communication',
            component: () => import("../views/mobile/Communication.vue"),
        },
        {
            path: '/mobile/record',
            name: 'mobile_record',
            component: () => import("../views/mobile/Record.vue"),
        },



        {
            path: '/',
            name: 'layout',
            component: Layout,
            redirect: '/home/index',
            children: [
                {
                    path: '/home/index',
                    name: 'home_index',
                    component: () => import("../views/home/Index.vue"),
                },
                {
                    path: '/work/index',
                    name: 'work_index',
                    component: () => import("../views/work/Index.vue"),
                },
                {
                    path: '/user/index',
                    name: 'user_index',
                    component: () => import("../views/user/Index.vue"),
                },

            ]
        }
    ]
})

router.afterEach((to, from) => {
    //存储路径
    localStorage.setItem("active", to.path)
})
export default router
